home *** CD-ROM | disk | FTP | other *** search
- unit MsgDlgs;
-
- interface
-
- uses
- Forms, StdCtrls, Dialogs;
-
- function MessageDlgDef(const Msg: string; AType: TMsgDlgType;
- AButtons: TMsgDlgButtons; DefButton: TModalResult;
- HelpCtx: Longint): TModalResult;
-
- function MessageDlgDefPos(const Msg: string; AType: TMsgDlgType;
- AButtons: TMsgDlgButtons; DefButton: TModalResult;
- HelpCtx: Longint; X, Y: Integer): TModalResult;
-
- implementation
-
- function MessageDlgDef(const Msg: string; AType: TMsgDlgType;
- AButtons: TMsgDlgButtons; DefButton: TModalResult;
- HelpCtx: Longint): TModalResult;
- begin
- Result := MessageDlgDefPos(Msg, AType, AButtons,
- DefButton, HelpCtx, -1, -1);
- end;
-
- function MessageDlgDefPos(const Msg: string; AType: TMsgDlgType;
- AButtons: TMsgDlgButtons; DefButton: TModalResult;
- HelpCtx: Longint; X, Y: Integer): TModalResult;
- var
- I: Integer;
- begin
- Result := 0;
- with CreateMessageDialog(Msg, AType, AButtons) do
- try
- HelpContext := HelpCtx;
- if X > -1 then Left := X;
- if Y > -1 then Top := Y;
- ScaleBy(Screen.PixelsPerInch, 96);
- { Change the default button }
- for I := 0 to Pred(ComponentCount) do
- if Components[I] is TButton then
- if TButton(Components[I]).ModalResult = DefButton then
- ActiveControl := TButton(Components[I]);
- Result := ShowModal;
- finally
- Free;
- end;
- end;
-
- end.
-